package it.learn.kafka.consumer92;

import it.learn.kafka.consumer92.client.Test01Client;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

@Component
public class RestTemplateUtil implements CommandLineRunner {

    @Autowired
    private RestTemplate restTemplate;

    @Autowired
    private Test01Client test01Client;

    @Override
    public void run(String... args) throws Exception {

        String result = restTemplate.getForObject("http://localhost:8082/test01", String.class);
        System.out.println("result = " + result);

        String result2 = test01Client.hello01();
        System.out.println("result2 = " + result2);

    }

}
